package com.exam.service.impl;

import com.exam.mapper.SubjectMapper;
import com.exam.pojo.Subject;
import com.exam.service.SubjectService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author: 黄星
 */
@Service("subjectServiceImpl")
public class SubjectServiceImpl implements SubjectService {

	@Resource(name = "subjectMapper")
	private SubjectMapper subjectMapper;

	public List<Subject> getSubjectByMajorIdAndClassesId(Integer majorId, Integer classesId) {
		Map<String,Integer> map = new HashMap<String, Integer>(  );
		map.put( "majorId",majorId );
		map.put( "classesId",classesId );
		return subjectMapper.getSubjectByMajorIdAndClassesId( map );
	}

	public Subject getSubjectById(Integer subjectId) {
		return subjectMapper.getSubjectById( subjectId );
	}

	public List<Subject> getSubjectByMajorId(Integer majorId) {
		return subjectMapper.getSubjectByMajorId( majorId );
	}

	/**
	 * 获取所有学科
	 * @return 学科列表
	 */
	@Override
	public List<Subject> getAllSubject() {
		return subjectMapper.getAllSubject();
	}
		
}
